package pzl.com.androidloader.broadcastreceiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;

import pzl.com.androidloader.loader.Baker;

/**
 * Created by zl.peng on 2016/10/8 22:52.
 */
public class Bakery extends BroadcastReceiver {
    final Baker mBaker;
    public static final String ACTION_RECEIVER_BAKERY = "pzl.com.androidloader.action.receiver.bakey";

    public Bakery(Baker baker) {
        mBaker = baker;
        IntentFilter filter = new IntentFilter(ACTION_RECEIVER_BAKERY);
        mBaker.getContext().registerReceiver(this, filter);
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        //通知面包师来客人了，要做面包了。
        mBaker.onContentChanged();
    }
}
